<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>while循环</title>
    
</head>
<body>
    <script type="text/javascript">
        var i = 0; // 初始化变量
        while(i < 100){
            console.log(i);
            htmlStr = '<p>' + i + '</p>'
            document.write(htmlStr);
            i++;
        }
    </script>
</body>
</html>